/* This file is part of the Pardus Economy Planner.

   The Pardus Economy Planner is free software: you can redistribute it
   and/or modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation, either version 3 of
   the License, or (at your option) any later version.

   The Pardus Economy Planner is distributed in the hope that it
   will be useful, but WITHOUT ANY WARRANTY; without even the implied
   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   See the GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with the Pardus Economy Planner.  If not, see
   <http://www.gnu.org/licenses/>.
*/

/// <reference path="../base.js" />
/// <reference path="../Libs/Mootools-Core.js" />
/// <reference path="../utility/config.js" />

Panels.Config.Load = function()
{
  Utility.Config.Read();

  var container = $("ConfigTableArea");
  var html = "<table>";

  for (var config in Utility.Config.Data)
  {
    if (!Utility.Config.Data.hasOwnProperty(config) || config == "Version")
      continue;

    var entry = Utility.Config.Data[config];

    html += "<tr>"
          + "<td>" + entry.name + "</td>"
          + "<td><input type='text' value='" + entry.value + "' onBlur='Utility.Config.Set(\"" + config + "\", this.value);' /></tr>"
          + "</tr>";
  }

  html += "</table>";
  container.set("html", html);
}

window.addEvent("domready", Panels.Config.Load);